package Revise;

import java.util.Arrays;

public class OddEven {
    public static void main(String[] args) {
        int[] arr = {1,2,2,2,2,2,1,5,4,6,4,6,4,6,1,9,5,3};
        adj(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void adj(int[] arr) {
        int left = 0;
        int right = arr.length - 1;
        while (left < right) {
            while (left < right && arr[left] % 2 != 0) {
                left++;
            }
            while (left < right && arr[right] % 2 == 0) {
                right--;
            }
            int temp=arr[right];
            arr[right]=arr[left];
            arr[left]=temp;
        }
    }

}
